package algorithms.dijkstra;

import java.awt.Point;

import graph.LinkedNodeList;
import graph.Node;

public class NewDNode extends Node implements Comparable<NewDNode> {
	private int distanceFromStart;
	
	public NewDNode(Point location) {
		super(location);
		this.distanceFromStart = Integer.MAX_VALUE;
	}
	
	public NewDNode(Node node) {
		super(new Point(node.getLocation()), node.getType());
		this.distanceFromStart = Integer.MAX_VALUE;
	}
	
	public int getDistanceFromStart() {
		return distanceFromStart;
	}

	public void setDistanceFromStart(int distanceFromStart) {
		this.distanceFromStart = distanceFromStart;
	}
		
	@Override
	public LinkedNodeList<NewDNode> getNeighbours() {
		return (LinkedNodeList<NewDNode>) super.getNeighbours();
	}
	
	@Override
	public int compareTo(NewDNode object) {
		
		if (object == this) 
			return 0;

		if (this.getDistanceFromStart() < object.getDistanceFromStart()) 
			return -1;
		else if (this.getDistanceFromStart() > object.getDistanceFromStart()) 
			return 1;
		else 
			return 0;
	}
	
}
